﻿/****************************** Module Header ******************************\

Copyright (c) Gary Davidson

This source is subject to the Microsoft Public License.
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
All other rights reserved.

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

using System;
using System.Linq;
using System.Xml.Linq;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.Win32; 
namespace Savviety.ServiceManager.Facade
{ 

public class SCSMIncidentSettings 
	{
	
		// Prefix For Identifier Property
public string PrefixForIdentifier {get;set;} 
		// Max Attachments Property
public int MaxAttachments {get;set;} 
		// Priority Min Value Property
public int PriorityMinValue {get;set;} 
		// Priority Max Value Property
public int PriorityMaxValue {get;set;} 
		// Data Retention Time Property
public int DataRetentionTime {get;set;} 
		// Data Retention Time Unit Property
public int DataRetentionTimeUnit {get;set;} 
		// Operations Manager Web Console URL Property
public string OperationsManagerWebConsoleURL {get;set;} 
		// Max Attachment Size Property
public int MaxAttachmentSize {get;set;} 
		// Priority Matrix Property
public string PriorityMatrix {get;set;} 
		// Resolution Mappings Property
public string ResolutionMappings {get;set;} 
		// Default Support Group Property
public string DefaultSupportGroup {get;set;} 
		// Display Name Property
public string DisplayName {get;set;} 
		

public int GetPriority(Guid urgency, Guid impact)
{

    var el = XElement.Parse(PriorityMatrix);

    var priority = el.Elements().Where(x => x.Attribute("Id").Value == urgency.ToString()).First().Elements().Where(x => x.Attribute("Id").Value == impact.ToString()).First();

    return int.Parse(priority.Value);

}


	}
}